 {

        var o = require("../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                tableModel: null,
                desktop: {
                    default: null,
                    type: cc.Node
                },
                labRemainCount: {
                    default: null,
                    type: cc.Label
                },
                nodeGameCount: {
                    default: null,
                    type: cc.Node
                },
                nodeTrustee: {
                    default: null,
                    type: cc.Node
                },
                Node_operation: {
                    default: null,
                    type: cc.Node
                },
                Node_multigang_operation: {
                    default: null,
                    type: cc.Node
                },
                Node_absence: {
                    default: null,
                    type: cc.Node
                },
                nodePeng: {
                    default: null,
                    type: cc.Prefab
                },
                nodeGang: {
                    default: null,
                    type: cc.Prefab
                },
                nodeHu: {
                    default: null,
                    type: cc.Prefab
                },
                nodeGuo: {
                    default: null,
                    type: cc.Prefab
                },
                nodeChi: {
                    default: null,
                    type: cc.Prefab
                },
                nodeTing: {
                    default: null,
                    type: cc.Prefab
                },
                nodeHuanPai: {
                    default: null,
                    type: cc.Prefab
                },
                nodeAbsence: {
                    default: null,
                    type: cc.Prefab
                },
                nodeTingActions: {
                    default: null,
                    type: cc.Node
                },
                nodeEffect: {
                    default: null,
                    type: cc.Node
                },
                effectNodeTableStartPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeCrapShootPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodePengPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeChiPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeTingPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeGangPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeHuPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeZiMoPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                nodeHuanPaiCrossPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                nodeHuanPaiClockPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                nodeHuanPaiAntiClockPrefab: {
                    default: null,
                    type: cc.Prefab
                },
                nodeDoAbsenceDown: {
                    default: null,
                    type: cc.Prefab
                },
                nodeDoAbsenceRight: {
                    default: null,
                    type: cc.Prefab
                },
                nodeDoAbsenceUp: {
                    default: null,
                    type: cc.Prefab
                },
                nodeDoAbsenceLeft: {
                    default: null,
                    type: cc.Prefab
                },
                spHeadColorDown: {
                    default: null,
                    type: cc.Sprite
                },
                spHeadColorRight: {
                    default: null,
                    type: cc.Sprite
                },
                spHeadColorUp: {
                    default: null,
                    type: cc.Sprite
                },
                spHeadColorLeft: {
                    default: null,
                    type: cc.Sprite
                },
                effectScoreChange: {
                    default: null,
                    type: cc.Prefab
                },
                Node_result: {
                    default: null,
                    type: cc.Node
                },
                effectNodeGameEnd: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeWind: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodeRain: {
                    default: null,
                    type: cc.Prefab
                },
                effectNodePlayerStatus: {
                    default: null,
                    type: cc.Prefab
                },
                Node_zhuangFirst: {
                    default: null,
                    type: cc.Node
                },
                waterScore: {
                    default: null,
                    type: cc.Label
                },
                menuNode: {
                    default: null,
                    type: cc.Node
                },
                menuItemPre: {
                    default: null,
                    type: cc.Prefab
                },
                nodeTingTip: {
                    default: null,
                    type: cc.Node
                },
                bigPlayedTilePre: {
                    default: null,
                    type: cc.Prefab
                },
                node_btnChangeTable: {
                    default: null,
                    type: cc.Node
                },
                remainTipPre: {
                    default: null,
                    type: cc.Prefab
                },
                nodeChangeTip: {
                    default: null,
                    type: cc.Node
                },
                nodeTest: {
                    default: null,
                    type: cc.Node
                },
                prefabLuckyFlower: {
                    default: null,
                    type: cc.Prefab
                },
                prefabSpeedShowTips: {
                    default: null,
                    type: cc.Prefab
                },
                prefabAdCrossItem: {
                    default: null,
                    type: cc.Prefab
                },
                labCurTime: {
                    default: null,
                    type: cc.Label
                },
                labUserId: {
                    default: null,
                    type: cc.Label
                },
                effectPosDownX: 0,
                effectPosDownY: 0,
                effectPosRightX: 0,
                effectPosRightY: 0,
                effectPosUpX: 0,
                effectPosUpY: 0,
                effectPosLeftX: 0,
                effectPosLeftY: 0,
                _time: 0,
                _curOptSeatId: 0,
                _absenceData: null,
                _askBackPanel: null,
                waterScoreFnt: [],
                _animationCount: 0
            },
            onLoad: function () {
                this.timer = Global.utils.searchNode(this.node, "Node_Timer"), this.timerCrapArea = Global.utils.searchNode(this.timer, "spLightMask"),
                    this.labTime = Global.utils.searchNode(this.timer, "labTime"), this.nodeTable = Global.utils.searchNode(this.node, "layout_mid"),
                    this.bigPlayedTileContainer = Global.utils.searchNode(this.node, "Node_bigPlayedTile"),
                    this.crapShootArr = [], this.originNum = 0, this.total = 0, Global.tableModel.setInGameScene(!0),
                    Global.notificationCenter.on(Global.eventName.GAME_CRAPSHOOT, this.onCrapShoot.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_RESULT, this.onShowResult.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_REFRESH_REMAIN_COUNT, this.onRefreshRemainCount.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_REFRESH_OPRETATION, this.onRefreshOperation.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_CLEAR_OPERTATION, this.onClearOperation.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_GUO, this.onClearOperation.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_GANG, this.onClearOperation.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_PENG, this.onClearOperation.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_HU, this.onClearOperation.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_CHI, this.onClearOperation.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_MULTIGANG, this.onShowMultiGang.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_ASKHUANPAI, this.onShowAskHuanPai.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_ACCEPT_HUANPAI, this.onAcceptHuanPai.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_ABSENCE, this.onShowAbsence.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_TING_ACTION, this.onShowTingActions.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_UPDATE_TING_ACTION, this.updateTingActions.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_PLAY_EFFECT_PENG, this.onPlayEffectPeng.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_PLAY_EFFECT_TING, this.onPlayEffectTing.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_PLAY_EFFECT_CHI, this.onPlayEffectChi.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_PLAY_EFFECT_GANG, this.onPlayEffectGang.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_PLAY_EFFECT_HU, this.onPlayEffectHu.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_DO_ABSCENCE_ANI, this.doAbsenceAni.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_DETAIL_CHANGE_SCORES, this.onScoreChange.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_TIMER, this.setTimerActive.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_DESTROY_CRAPSHOOT, this.desCrapShoot.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_SCORE_DATA, this.getWaterScore.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_TINGTIP, this.setNodeTingTipActive.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_SHOW_BIGPLAYEDTILE, this.showBigPlayedTile.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_DES_BIGPLAYEDTILE, this.deleteBigPlayedTile.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_RECONNECT, this.onReconnectNetWork.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_ENTER_BACKGROUND, this.onEnterBackground.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_CREATE_TABLE_DISSOLUTION, this.showApplyFrame.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_CHARGED, this.onChargeResult.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_SHOW_CONFIRM_LOOSE, this.showLoseEffect.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_CHARGING, this.showZZCCEffect.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_SHOWZHUANGJIATIP, this.showZhuangjiaTip.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_FINISH_DING_QUE, this.showDingTips.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_ALL_FINISH_DING_QUE, this.hideDingTips.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_SHOW_LUCKY_TILES, this.showLuckyFlower.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_SHOW_TIPS, this.showSpeedMahTip.bind(this), this),
                    this.nodeTable.on("touchend", this.onTableClick.bind(this), this), this.nodeTingActions && (this.nodeTingActions.active = !1),
                this.spHeadColorDown && (this.spHeadColorDown.node.active = !1), this.spHeadColorRight && (this.spHeadColorRight.node.active = !1),
                this.spHeadColorUp && (this.spHeadColorUp.node.active = !1), this.spHeadColorLeft && (this.spHeadColorLeft.node.active = !1),
                this.nodeTingTip && (this.nodeTingTip.active = !1), this.nodeTest, this.tableModel = Global.tableModel,
                this.tableModel && 1 == this.tableModel.isReconnect() && Global.notificationCenter.emit(Global.eventName.GAME_REFRESH_STAND_TILE),
                this.effectNodePlayerStatus && (this.effectNodePlayerStatus.active = !1), this.chargingEffect = {},
                    this.gameResultData = null, this.gameTotalResultData = null, this.isPlayGameEndPlayerStatus = !1,
                    this.hadShowResult = !1, this.tableModel && 1 != this.tableModel.isReconnect() && this.setTimerActive(!1);
                for (var e = this, t = 1; t < 3; t++) cc.loader.loadRes("Texture/font/ZT_SZ" + t, cc.Font, function (t, n) {
                    n && e && e.waterScoreFnt && e.waterScoreFnt.push(n);
                });
                this.nodeBtnRule = Global.utils.searchNode(this.node, "btnRule"), this.initUI();
            },
            initUI: function () {
                (this.setRightUIActive(), Global.tableModel.getTableType() == Global.config.tableType.CREATE) && (this.nodeGameCount.active = !0,
                    Global.utils.searchComp(this.nodeGameCount, "labGameCount", cc.Label).string = Global.tableModel.getCurrentNumberOfGames() + 1 + "/" + Global.tableModel.getTotalOfGames() + "局");
                this.wxFeature(), this.labUserId && Global.userProfile && (this.labUserId.string = "ID：" + Global.userProfile.getUserId());
                var e = 0;
                this.labCurTime && (e = new Date(), this.labCurTime.string = "时钟：" + e.getHours() + ":" + e.getMinutes() + ":" + e.getSeconds()),
                    this.schedule(function () {
                        this.labCurTime && (e = new Date(), this.labCurTime.string = "时钟：" + e.getHours() + ":" + e.getMinutes() + ":" + e.getSeconds());
                    }.bind(this), 1);
            },
            wxFeature: function () {
                cc.sys.platform == cc.sys.WECHAT_GAME ? (cc.find("Canvas").fitHeight = !0, cc.find("Canvas").fitWidth = !1) : (cc.find("Canvas").fitHeight = !1,
                    cc.find("Canvas").fitWidth = !0);
                var e = Global.utils.searchComp(this.desktop, "Node_stand_left", cc.Widget),
                    t = Global.utils.searchComp(this.desktop, "Node_peng_left", cc.Widget),
                    n = Global.utils.searchComp(this.desktop, "Node_hu_left", cc.Widget),
                    o = Global.utils.searchComp(this.desktop, "Node_head_left", cc.Widget),
                    i = Global.utils.searchComp(this.desktop, "Node_stand_right", cc.Widget),
                    a = Global.utils.searchComp(this.desktop, "Node_peng_right", cc.Widget),
                    r = Global.utils.searchComp(this.desktop, "Node_hu_right", cc.Widget),
                    s = Global.utils.searchComp(this.desktop, "Node_head_right", cc.Widget),
                    l = Global.utils.searchComp(this.desktop, "Node_stand_down", cc.Widget),
                    c = Global.utils.searchComp(this.desktop, "Node_hu_down", cc.Widget),
                    d = Global.utils.searchComp(this.desktop, "Node_head_down", cc.Widget),
                    u = Global.utils.searchComp(this.desktop, "Node_stand_up", cc.Widget),
                    h = Global.utils.searchComp(this.desktop, "Node_peng_up", cc.Widget),
                    f = Global.utils.searchComp(this.desktop, "Node_hu_up", cc.Widget),
                    p = Global.utils.searchComp(this.desktop, "Node_head_up", cc.Widget);
                if (2 == tywx.UserInfo.systemType) {
                    if (e.left = 400, t.left = 160, n.left = 337, o.left = 162, i.right = 273, a.right = 334,
                        r.right = 386, s.right = 199, l.left = 266, c.right = 388, d.left = 181, u.right = 526,
                        h.left = 361, f.left = 467, p.right = 453, this.menuNode) {
                        var g = this.menuNode.getComponent(cc.Widget);
                        g && (g.left += 50);
                    }
                    if (this.labRemainCount && this.labRemainCount.node.parent) {
                        var b = this.labRemainCount.node.parent.getComponent(cc.Widget);
                        b && (b.left += 50);
                    }
                } else if (tywx.SystemInfo.wxSystemInfo && tywx.SystemInfo.wxSystemInfo.screenWidth / tywx.SystemInfo.wxSystemInfo.screenHeight > 16 / 9) {
                    e.left = 350, t.left = 110, n.left = 287, o.left = 112, i.right = 223, a.right = 284,
                        r.right = 336, s.right = 149, l.left = 216, c.right = 338, d.left = 131, u.right = 476,
                        h.left = 281, f.left = 417, p.right = 403;
                    var m = tywx.UserInfo.model;
                    m && m.indexOf("iPhone 6") >= 0 && (l.left = 190, c.right = 340, d.left = 94);
                }
            },
            doQuickStart: function (e) {
                if ((e = e || Global.roomInfoModel.getRecommendRoomId()) < 0) {
                    cc.error("tableController doQuickStart roomId<0");
                    var t = {
                        text: "金币不足，快去分享获取金币吧！",
                        cancelSp: Global.spriteAtlas.getGoInviteSpf(),
                        cancelText: "去邀请",
                        cancelCallback: function () {
                            Global.UIPopupManager.addPopup("PopupPanel/Panel_InviteFri", function (e) {
                            });
                        },
                        closeCallback: function () {
                            console.log("closeCallback");
                        },
                        needConfirmBtn: !1
                    };
                    Global.UIPopupManager.alert(t);
                } else {
                    Global.roomInfoModel.setRoomId(e);
                    var n = Global.roomInfoModel.getPlayModel();
                    Global.msgHandler.requestQuickStart(n, e);
                }
            },
            showApplyFrame: function (e) {
                var t = Global.utils.searchNode(this.node, "Panel_applyDisbandRoom");
                t ? t.getComponent("applyDisbandRoomPanel").transmitData(e) : Global.UIPopupManager.addPopup("PopupPanel/Panel_applyDisbandRoom", function (t) {
                    t.transmitData(e);
                });
            },
            showSpeedMahTip: function (e) {
                var t = cc.instantiate(this.prefabSpeedShowTips), n = Global.utils.searchComp(t, "label", cc.Label);
                e.gameId == Global.config.GAMEID_ERRENQUICK ? (n.string = "小提示：" + e.tips, this.Node_result && this.Node_result.addChild(t, 101),
                    t.runAction(cc.sequence(cc.delayTime(3), cc.removeSelf()))) : e.tips.indexOf("胡牌不能超过带入") > 0 && (n.string = "小提示：" + e.tips,
                this.Node_result && this.Node_result.addChild(t, 101), t.runAction(cc.sequence(cc.delayTime(1.5), cc.removeSelf())));
            },
            showDingTips: function () {
                var e = Global.utils.searchNode(this.Node_absence, "dingQueTips");
                e && (e.active = !0);
            },
            hideDingTips: function () {
                var e = Global.utils.searchNode(this.Node_absence, "dingQueTips");
                e && (e.active = !1);
            },
            deleteBigPlayedTile: function () {
                this.bigPlayedTile && (this.bigPlayedTile.destroy(), this.bigPlayedTile = null);
            },
            showBigPlayedTile: function (e) {
                var t = e.seatIdLocal;
                e.playerModel;
                if (this.deleteBigPlayedTile(), t != Global.config.SEAT_DOWN) {
                    var n = e.tile, o = {
                        pos: [{
                            x: 346,
                            y: 50
                        }, {
                            x: 4,
                            y: 261
                        }, {
                            x: -330,
                            y: 50
                        }][t - 1],
                        tileName: "mj_az_01_" + n
                    }, i = function () {
                        this.bigPlayedTile = cc.instantiate(this.bigPlayedTilePre), this.bigPlayedTileContainer && this.bigPlayedTileContainer.addChild(this.bigPlayedTile),
                            this.bigPlayedTile.getComponent("NodeBigPlayedTile").setData(o), this.bigPlayedTile.getComponent(cc.Animation).play("scaleToAppear");
                    }.bind(this);
                    this.bigPlayedTilePre ? i() : cc.loader.loadRes("prefabs/nodeBigPlayedTile", function (e, t) {
                        e && cc.error("showBigPlayedTile prefab == null", JSON.stringify(e)), this.bigPlayedTilePre = t,
                        cc.isValid(this.node) && i();
                    }.bind(this));
                }
            },
            setRightUIActive: function () {
                Global.tableModel.getTableType() != Global.config.tableType.CREATE && Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERREN && Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERRENQUICK || (Global.utils.searchNode(this.node, "btnBill").active = !1),
                Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK && (this.nodeBtnRule.active = !0);
            },
            getWaterScore: function (e) {
                console.log("getWaterScore === ", e), console.log("getWaterScore === ", this.waterScoreFnt);
                var t = this;
                if (Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN)) {
                    var n = e.detailDescList || [];
                    if (n.length > 0) {
                        this.originNum = this.total, this.total = 0;
                        for (var o = 0; o < n.length; o++) this.total += parseInt(n[o][2]);
                        var i = cc.scaleTo(.2, .3), a = cc.scaleTo(.15, 1);
                        this.originNum != this.total && this.waterScore.node.runAction(new cc.Sequence(i, cc.callFunc(function () {
                            t.waterScore.string = Global.utils.exchangeToWan(t.total);
                        }), a)), this.waterScore.font = this.waterScoreFnt[0], this.total < 0 && (this.waterScore.font = this.waterScoreFnt[1]);
                    } else this.waterScore.string = 0;
                }
            },
            start: function () {
                this.tableModel && 1 != this.tableModel.isReconnect() && (console.log("tableController start this.tableModel:", this.tableModel.isReconnect()),
                    this.tableStartAni()), Global.utils.showBanner(!1);
            },
            tableStartAni: function () {
                cc.sys.platform == cc.sys.WECHAT_GAME && wx.vibrateLong({});
                var e = cc.instantiate(this.effectNodeTableStartPrefab);
                this.node.addChild(e);
                var t = e.getComponent(cc.Animation);
                t.on("finished", function () {
                    this.tableModel.doCrapShoot(), e.destroy();
                }.bind(this), this), t.play("kaiju"), o.playStartGameEffect();
            },
            update: function (e) {
                this.labRemainCount && (this.labRemainCount.string = Global.tableModel.getRemainCount() + "张",
                Global.tableModel.getRemainCount() > 0 && Global.tableModel.getRemainCount() < 20 && !this.isShowRemainTip && (this.isShowRemainTip = !0,
                    this.showRemainTip())), this.nodeTrustee && (this.nodeTrustee.active = Global.tableModel.isTrustee() && !Global.tableModel.isTing() && !Global.tableModel.getIsGameEnd());
            },
            showRemainTip: function () {
                console.log("showRemainTip");
                var e = cc.instantiate(this.remainTipPre);
                this.node.addChild(e), e.runAction(cc.sequence(cc.delayTime(3), cc.callFunc(function () {
                    e.destroy();
                }.bind(this))));
            },
            onDestroy: function () {
                Global.tableModel.setAllowPopupRotateLuckInGameEnd(!1), Global.notificationCenter.offAll(this),
                    Global.tableModel.setInGameScene(!1);
            },
            setTimerActive: function (e) {
                this.labTime.active = e;
            },
            desCrapShoot: function () {
                for (var e = 0; e < this.crapShootArr.length; e++) this.crapShootArr[e].destroy();
                this.crapShootArr = [];
            },
            onCrapShoot: function (e) {
                cc.log("===========onCrapShoot  掷骰子 =================");
                var t = [{
                    x: -17.4,
                    y: 7.8
                }, {
                    x: 17.8,
                    y: -13.1
                }], n = [{
                    x: -7.9,
                    y: -14.2
                }, {
                    x: 10.4,
                    y: 9.7
                }], i = Math.random() > .5, a = i ? t : n, r = i ? n : t;
                this._aniRollTime = {};
                for (var s = 0; s < 2; s++) {
                    var l = cc.instantiate(this.effectNodeCrapShootPrefab);
                    this.timerCrapArea && this.timerCrapArea.addChild(l);
                    var c = a[s].x + Math.random(0, 0), d = a[s].y + Math.random(0, 0);
                    l.setPosition(c, d);
                    var u = l.getComponent(cc.Animation), h = {
                        data: e[s],
                        item: l,
                        index: s
                    }, f = "item" + s;
                    this._aniRollTime[f] = 0;
                    var p = Global.utils.randomInt(3, 6);
                    u.on("finished", this.onceRoll.bind(this, h, p), this), u.play("effectCrapShoot"),
                        this.crapShootMove(l, s, .18 * p, l.getPosition(), r[s]), this.crapShootArr.push(l);
                }
                o.playDiceEffect();
            },
            crapShootMove: function (e, t, n, o, i) {
                var a;
                cc.log("bezier---");
                var r = o, s = i, l = r.x - s.x <= 0 ? 1 : -1, c = r.y - s.y <= 0 ? 1 : -1, d = cc.pDistance(r, s),
                    u = Math.tan(Math.PI / 6) * d / 2, h = cc.p((r.x + s.x) / 2, (r.y + s.y) / 2),
                    f = Math.abs(s.y - r.y) / d * u, p = Math.abs(s.x - r.x) / d * u, g = cc.p(h.x + f, h.y + p);
                1 === (0 == t ? -1 : 1) ? c * l == 1 ? g = cc.p(h.x - f, h.y + p) : c * l == -1 && (g = cc.p(h.x + f, h.y + p)) : c * l == 1 ? g = cc.p(h.x + f, h.y - p) : c * l == -1 && (g = cc.p(h.x - f, h.y - p)),
                    a = [g, g, s];
                var b = cc.bezierTo(n, a).easing(cc.easeInOut(3));
                e.runAction(b);
            },
            onceRoll: function (e, t) {
                var n = e.item, o = "item" + e.index, i = n.getComponent(cc.Animation);
                if (this._aniRollTime[o]++, this._aniRollTime[o] > t) return n.stopAllActions(),
                    this.setCrapShootData(e), void (this._aniRollTime[o] = 0);
                i.playAdditive("effectCrapShoot");
            },
            setCrapShootData: function (e) {
                var t = e.item, n = e.data, o = Global.utils.searchNode(t, "sp").getComponent(cc.Sprite);
                Global.spriteAtlas.setSpriteFrame(o, "Texture/crapShootEffect", n + "dian");
            },
            setNodeTingTipActive: function (e) {
                this.nodeTingTip.active = e, e || (Global.notificationCenter.emit(Global.eventName.GAME_SHOW_TING_ACTION, null),
                    this.setIsShowingTingTip(!1));
            },
            onShowResult: function (e) {
                var t = Global.utils.searchNode(this.node, "Panel_recharge");
                t && (t.active = !1), this._askBackPanel && (Global.UIPopupManager.removePopup(this._askBackPanel),
                    this._askBackPanel = null), this.gameResultData = e, 0 == this.isPlayGameEndPlayerStatus && this.onGameEndEffectEnd();
            },
            showResult: function (e) {
                if (!this.hadShowResult) {
                    var t = this;
                    if (this.hadShowResult = !0, this.clearOperation(), tywx.BiLog.clickStat(tywx.clickStatEventType.clickStatEventType_TABLE_END, []),
                        Global.utils.showBanner(!0, null, 0, 0), Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK) {
                        for (var n = !1, i = 0; i < e.infos.length; i++) {
                            var a = e.infos[i];
                            if (a.seatId == Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN).getSeatId() && 0 == a.totalScore) {
                                n = !0;
                                break;
                            }
                        }
                        n ? cc.loader.loadRes("prefabs/gameResult/effectNodeLiuJu", function (i, a) {
                            var r = cc.instantiate(a), s = t.Node_result;
                            s && r && (s.addChild(r, 10), r.setPosition(cc.p(0, 0)), r.getComponent("NodeGameResultQuickController").bindData(e, n),
                                o.playGameEnd());
                        }) : cc.loader.loadRes("prefabs/gameResult/nodeGameResultQuick", function (n, i) {
                            var a = cc.instantiate(i), r = t.Node_result;
                            r && a && (r.addChild(a, 10), a.setPosition(cc.p(0, 0)), a.getComponent("NodeGameResultQuickController").bindData(e),
                                o.playGameEnd());
                        });
                    } else {
                        for (var r = 0; r < e.infos.length; ++r) {
                            var s = e.infos[r];
                            if (Global.tableModel.toLocalSeatIndex(s.seatId) == Global.config.SEAT_DOWN && s.daHuFan && s.patternInfo && s.totalScore > 0) return void cc.loader.loadRes("prefabs/gameResult/dahu", function (n, i) {
                                var a = cc.instantiate(i), r = t.Node_result;
                                r && a && (r.addChild(a, 10), a.setPosition(cc.p(0, 0)), a.getComponent("NodeGameResultMajorController").bindData(e),
                                    o.playGameEnd());
                                t.menuNode && (t.menuNode.active = !1);
                            });
                        }
                        Global.tableModel.getTableType() == Global.config.tableType.SCORE_TABLE ? Global.UIPopupManager.addPopup("PopupPanel/ContinueVictory/Panel_continueVictoryResult", function (t) {
                            t.getComponent("continueVictoryResult").bindData(e);
                        }) : cc.loader.loadRes("prefabs/gameResult/nodeGameResultNew", function (n, i) {
                            var a = cc.instantiate(i), r = t.Node_result;
                            r && a && (r.addChild(a, 10), a.setPosition(cc.p(0, 0)), a.getComponent("NodeGameResultNewController").bindData(e),
                                o.playGameEnd());
                            t.menuNode && (t.menuNode.active = !1), cc.log("tywx.UserInfo.isCreate =", Global.config.peoplePlayGameNums),
                            tywx.UserInfo && 1 == tywx.UserInfo.isCreate || tywx.UserInfo && 0 == tywx.UserInfo.isCreate && (Global.config.peoplePlayGameNums += 1,
                                cc.log("Global.config.peoplePlayGameNums =", Global.config.peoplePlayGameNums));
                        });
                    }
                    Global.notificationCenter.emit(Global.eventName.MSG_STOP_HEAD_EFFECT);
                }
            },
            onRefreshRemainCount: function () {
                this.labRemainCount && (this.labRemainCount.string = "剩余:" + Global.tableModel.getRemainCount());
            },
            onRefreshOperation: function (e) {
                var t = this;
                if (console.log("onRefreshOperation data:", e), this.clearOperation(), null != this.Node_operation) {
                    var n = [];
                    if (1 == e.hasOwnProperty("peng_action")) (o = cc.instantiate(this.nodePeng)).getComponent("OperationController").bindData(e.peng_action[0]),
                        n.push(o);
                    if (1 == e.hasOwnProperty("gang_action") && e.gang_action.length > 0) (o = cc.instantiate(this.nodeGang)).getComponent("OperationController").bindData(e.gang_action),
                        n.push(o);
                    if (1 == e.hasOwnProperty("win_degree")) (o = cc.instantiate(this.nodeHu)).getComponent("OperationController").bindData(e.tile),
                        n.push(o);
                    if (1 == e.hasOwnProperty("grab_bar")) (o = cc.instantiate(this.nodeHu)).getComponent("OperationController").bindData(e.tile, e.tile, !0),
                        n.push(o);
                    if (1 == e.hasOwnProperty("chi_action")) (o = cc.instantiate(this.nodeChi)).getComponent("OperationController").bindData(e.chi_action, e.tile),
                        n.push(o);
                    if (1 == e.hasOwnProperty("ting_action") && (Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERREN || Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK)) (o = cc.instantiate(this.nodeTing)).getComponent("OperationController").bindData(e.ting_action, e.tile),
                        n.push(o);
                    if (1 == e.hasOwnProperty("grabTing") && (Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERREN || Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK)) (o = cc.instantiate(this.nodeTing)).getComponent("OperationController").bindData(e.grabTing, e.tile),
                        n.push(o);
                    if (n.length > 0) {
                        var o = cc.instantiate(this.nodeGuo);
                        n.push(o), n.reverse();
                    }
                    for (var i = function () {
                        r = n[a], t.Node_operation && t.Node_operation.addChild(r), r.setPosition(cc.p(-140 * a, 0));
                        var e = r.getComponent(cc.Animation);
                        e && (e.on("finished", function () {
                            e.play("anniu_xunhuan");
                        }, t), e.play("anniu_appear"));
                    }, a = 0; a < n.length; a++) {
                        var r;
                        i();
                    }
                } else cc.error("TableController onRefreshOperation this.Node_operation = null");
            },
            onShowMultiGang: function (e) {
                this.clearOperation();
                var t = this;
                cc.loader.loadRes("prefabs/nodeMultiGang", function (n, o) {
                    var i = cc.instantiate(o), a = t.Node_multigang_operation;
                    if (a && i) {
                        a.addChild(i, 10), i.setPosition(cc.p(0, -58));
                        var r = i.getComponent("MultiGangController");
                        r && r.bindData(e, "gang");
                    }
                });
            },
            onShowAskHuanPai: function () {
                this.clearOperation();
                var e = cc.instantiate(this.nodeHuanPai);
                this.Node_multigang_operation && this.Node_multigang_operation.addChild(e);
            },
            onAcceptHuanPai: function (e) {
                this.clearOperation();
                var t = null;
                (1 == e.huanRule && (t = cc.instantiate(this.nodeHuanPaiClockPrefab)), 2 == e.huanRule && (t = cc.instantiate(this.nodeHuanPaiAntiClockPrefab)),
                3 == e.huanRule && (t = cc.instantiate(this.nodeHuanPaiCrossPrefab)), t) ? (this.Node_multigang_operation && this.Node_multigang_operation.addChild(t),
                    t.getComponent(cc.Animation).onAniEnd = function () {
                        this.showAbsence();
                    }.bind(this)) : this.showAbsence();
            },
            onShowAbsence: function (e) {
                this._absenceData = e, 1 == e.reconnect && this.showAbsence();
            },
            showAbsence: function () {
                this.clearOperation();
                var e = cc.instantiate(this.nodeAbsence);
                this.Node_multigang_operation && this.Node_multigang_operation.addChild(e), this._absenceData && (console.log("showAbsence data:", JSON.stringify(this._absenceData)),
                    e.getComponent("NodeAbsenceController").playAni(this._absenceData.color));
            },
            doAbsenceAni: function (e) {
                if (1 == e.reconnect) this.showHeadAbsenceColor(e); else {
                    var t = Global.tableModel.toLocalSeatIndex(e.seatId), n = null;
                    if (t == Global.config.SEAT_DOWN) {
                        n = cc.instantiate(this.nodeDoAbsenceDown);
                        var i = Global.utils.searchNode(this.desktop, "Node_head_down").getChildByName("spHeadColor"),
                            a = cc.v2(0, -70);
                        this.commonFlyAnimate(n, i, a);
                    }
                    if (t == Global.config.SEAT_RIGHT) {
                        n = cc.instantiate(this.nodeDoAbsenceRight);
                        var r = Global.utils.searchNode(this.desktop, "Node_head_right").getChildByName("spHeadColor"),
                            s = cc.v2(160, 50);
                        this.commonFlyAnimate(n, r, s);
                    }
                    if (t == Global.config.SEAT_UP) {
                        n = cc.instantiate(this.nodeDoAbsenceUp);
                        var l = Global.utils.searchNode(this.desktop, "Node_head_up").getChildByName("spHeadColor"),
                            c = cc.v2(0, 200);
                        this.commonFlyAnimate(n, l, c);
                    }
                    if (t == Global.config.SEAT_LEFT) {
                        n = cc.instantiate(this.nodeDoAbsenceLeft);
                        var d = Global.utils.searchNode(this.desktop, "Node_head_left").getChildByName("spHeadColor"),
                            u = cc.v2(-150, 50);
                        this.commonFlyAnimate(n, d, u);
                    }
                    if (n) o.playDoAbsenceEffect(), n.getComponent("nodeDoAbsenceController").bindData(e.color),
                        n.getComponent(cc.Animation).onAniEnd = function () {
                            this.showHeadAbsenceColor(e), n.removeAllChildren(), this._animationCount++, this.showZhuangjiaTip(!0);
                        }.bind(this);
                    var h = Global.tableModel.getHeadSeat(), f = Global.tableModel.toLocalSeatIndex(h);
                    this.effectNodePlayerStatus && f == Global.config.SEAT_DOWN && (this.effectNodePlayerStatus.active = !0);
                }
            },
            commonFlyAnimate: function (e, t, n) {
                var o = this.Node_absence;
                Global.utils.itemFly({
                    startNode: o,
                    endNode: t,
                    duration: .6,
                    spriteFrame: null,
                    isDirection: !0,
                    followNode: e,
                    stayDuration: 1,
                    startOffset: n,
                    startdelay: .4
                });
            },
            showZhuangjiaTip: function (e) {
                console.log("showZhuangjiaTip", Global.tableModel.localPlayerIsHeader(), e), e ? (Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERREN && Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERRENQUICK || (this._animationCount = Global.config.PLAY_NUM),
                    console.log("showZhuangjiaTip header seatId:", Global.tableModel.getHeadSeat()),
                    console.log("showZhuangjiaTip myplayerModel seatId:", Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN).getSeatId()),
                Global.tableModel.localPlayerIsHeader() && this._animationCount == Global.config.PLAY_NUM && this.Node_zhuangFirst && (this.Node_result.removeAllChildren(),
                    this.Node_zhuangFirst.active = !0)) : this.Node_zhuangFirst && this.Node_zhuangFirst.active && (this.Node_zhuangFirst.active = !1,
                    this._animationCount = 0);
            },
            showHeadAbsenceColor: function (e) {
                var t = Global.tableModel.toLocalSeatIndex(e.seatId), n = null;
                if (t == Global.config.SEAT_DOWN && (n = this.spHeadColorDown), t == Global.config.SEAT_RIGHT && (n = this.spHeadColorRight),
                t == Global.config.SEAT_UP && (n = this.spHeadColorUp), t == Global.config.SEAT_LEFT && (n = this.spHeadColorLeft),
                    n) {
                    var o = null;
                    e.color == Global.config.tileColor.TILE_COLOR_WAN && (o = "GR_Label_wan"), e.color == Global.config.tileColor.TILE_COLOR_TONG && (o = "GR_Label_tong"),
                    e.color == Global.config.tileColor.TILE_COLOR_TIAO && (o = "GR_Label_tiao"), n.node.active = !0,
                        Global.spriteAtlas.setSpriteFrame(n, "Texture/table", o);
                }
            },
            onScoreChange: function (e) {
                var t = e.changeData, n = e.isGameEnd;
                null != t ? (this.isPlayGameEndPlayerStatus = !1, 1 == n ? (this.isPlayGameEndPlayerStatus = !0,
                    this.prossChangeScore(t)) : this.prossChangeScore(t)) : cc.error("onScoreChange error", "data = null");
            },
            prossChangeScore: function (e) {
                for (var t = [], n = [], o = [], i = [], a = [], r = [], s = 0; s < e.length; ++s) {
                    var l = e[s];
                    if (void 0 != l.detailChangeScores && void 0 != l.seatId) {
                        t.push(l);
                        var c = {
                            seatId: l.seatId,
                            winScore: l.detailChangeScores.winScore
                        };
                        n.push(c);
                        var d = {
                            seatId: l.seatId,
                            callTranScore: l.detailChangeScores.callTranScore
                        };
                        o.push(d);
                        var u = {
                            seatId: l.seatId,
                            huazhuScore: l.detailChangeScores.huazhuScore
                        };
                        i.push(u);
                        var h = {
                            seatId: l.seatId,
                            dajiaoScore: l.detailChangeScores.dajiaoScore
                        };
                        a.push(h);
                        var f = {
                            seatId: l.seatId,
                            tuishuiScore: l.detailChangeScores.tuishuiScore
                        };
                        r.push(f);
                    }
                }
                var p = function () {
                    var t = function () {
                        var t = function () {
                            var t = function () {
                                var t = function () {
                                    var t = function () {
                                        this.onGameEndEffectEnd();
                                    }.bind(this), n = cc.callFunc(t, this, e);
                                    this.doTuiShuiScore(r, n);
                                }.bind(this), n = cc.callFunc(t, this, e);
                                this.doDaJiaoScore(a, n);
                            }.bind(this), n = cc.callFunc(t, this, e);
                            this.doHuaZhuScore(i, n);
                        }.bind(this), n = cc.callFunc(t, this, e);
                        this.doCallTranScore(o, n);
                    }.bind(this), s = cc.callFunc(t, this, e);
                    this.doWinScore(n, s);
                }.bind(this), g = cc.callFunc(p, this, e);
                this.doGangScore(t, g);
            },
            doGangScore: function (e, t) {
                for (var n = 0, o = 0; o < e.length; ++o) for (var i = 0; i < e[o].detailChangeScores.length; ++i) {
                    var a = e[o].detailChangeScores[i].gangScore;
                    a && null != a.score && (n = this.doPlayScoreChangeValue(a, i, 1));
                }
                Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERREN && Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERRENQUICK || (n = 2),
                    this.node.runAction(cc.sequence(cc.delayTime(n), t));
            },
            doWinScore: function (e, t) {
                for (var n = 0, o = 0; o < e.length; ++o) {
                    var i = e[o].winScore;
                    i && null != i.score && (n = this.doPlayScoreChangeValue(i, e[o].seatId, 1));
                }
                this.node.runAction(cc.sequence(cc.delayTime(n), t));
            },
            doCallTranScore: function (e, t) {
                for (var n = 0, o = 0; o < e.length; ++o) {
                    var i = e[o].callTranScore;
                    if (i && null != i.score) (function (e, t) {
                        if (0 == e.state && e.score <= 0) {
                            var o = cc.instantiate(this.effectNodePlayerStatus);
                            o.getComponent("effectNodePlayerStatusController").bindData(1), this.nodeEffect && this.nodeEffect.addChild(o);
                            var i = this._getEffectPos(t);
                            o.setPosition(i), o.getComponent(cc.Animation).onAniEnd = function () {
                                o.removeFromParent(!0), o.destroy();
                            }.bind(this), n = this.doPlayScoreChangeValue(e, t, 1);
                        } else null != e.score && (n = this.doPlayScoreChangeValue(e, t, 1));
                    }).bind(this)(i, e[o].seatId);
                }
                this.node.runAction(cc.sequence(cc.delayTime(n), t));
            },
            doHuaZhuScore: function (e, t) {
                for (var n = 0, o = 0; o < e.length; ++o) {
                    var i = e[o].huazhuScore;
                    if (i && null != i.score) (function (e, t) {
                        if (0 == e.state && e.score <= 0) {
                            var o = cc.instantiate(this.effectNodePlayerStatus);
                            o.getComponent("effectNodePlayerStatusController").bindData(5), this.nodeEffect && this.nodeEffect.addChild(o);
                            var i = this._getEffectPos(t);
                            o.setPosition(i), o.getComponent(cc.Animation).onAniEnd = function () {
                                o.removeFromParent(!0), o.destroy();
                            }.bind(this), n = this.doPlayScoreChangeValue(e, t, 1);
                        } else null != e.score && (n = this.doPlayScoreChangeValue(e, t, 1));
                    }).bind(this)(i, e[o].seatId);
                }
                this.node.runAction(cc.sequence(cc.delayTime(n), t));
            },
            doDaJiaoScore: function (e, t) {
                for (var n = 0, o = 0; o < e.length; ++o) {
                    var i = e[o].dajiaoScore;
                    if (i && null != i.score) (function (e, t) {
                        if (0 == e.state && e.score <= 0) {
                            var o = cc.instantiate(this.effectNodePlayerStatus);
                            o.getComponent("effectNodePlayerStatusController").bindData(4), this.nodeEffect && this.nodeEffect.addChild(o);
                            var i = this._getEffectPos(t);
                            o.setPosition(i), o.getComponent(cc.Animation).onAniEnd = function () {
                                o.removeFromParent(!0), o.destroy();
                            }.bind(this), n = this.doPlayScoreChangeValue(e, t, 1);
                        } else null != e.score && (n = this.doPlayScoreChangeValue(e, t, 1));
                    }).bind(this)(i, e[o].seatId);
                }
                this.node.runAction(cc.sequence(cc.delayTime(n), t));
            },
            doTuiShuiScore: function (e, t) {
                for (var n = 0, o = 0; o < e.length; ++o) {
                    var i = e[o].tuishuiScore;
                    if (i && null != i.score) (function (e, t) {
                        if (0 == e.state && e.score <= 0) {
                            var o = cc.instantiate(this.effectNodePlayerStatus);
                            o.getComponent("effectNodePlayerStatusController").bindData(6), this.nodeEffect && this.nodeEffect.addChild(o);
                            var i = this._getEffectPos(t);
                            o.setPosition(i), o.getComponent(cc.Animation).onAniEnd = function () {
                                o.removeFromParent(!0), o.destroy();
                            }.bind(this), n = this.doPlayScoreChangeValue(e, t, 1);
                        } else null != e.score && (n = this.doPlayScoreChangeValue(e, t, 1));
                    }).bind(this)(i, e[o].seatId);
                }
                this.node.runAction(cc.sequence(cc.delayTime(n), t));
            },
            doPlayScoreChangeValue: function (e, t, n) {
                var i = 0;
                i = null == n ? 0 : n;
                var a = function () {
                    o.playScoreSound();
                    var n = cc.instantiate(this.effectScoreChange);
                    n.getComponent("effectScoreController").bindData(e), this.nodeEffect && this.nodeEffect.addChild(n);
                    var i = this._getEffectPos(t);
                    n.setPosition(i);
                    var a = n.getComponent(cc.Animation);
                    a.play(), a.onAniEnd = function () {
                        n.destroy();
                    }.bind(this);
                }.bind(this), r = cc.callFunc(a, this);
                return this.node.runAction(cc.sequence(cc.delayTime(i), r)), i + .8;
            },
            onGameEndEffectEnd: function () {
                if (this.isPlayGameEndPlayerStatus = !1, null != this.gameResultData) {
                    var e = function () {
                        this.showResult(this.gameResultData);
                    }.bind(this), t = cc.callFunc(e, this);
                    if (this.clearOperation(), Global.notificationCenter.emit(Global.eventName.GAME_SHOW_TINGTIP, !1),
                    Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK) this.node.runAction(t); else {
                        var n = cc.instantiate(this.effectNodeGameEnd);
                        if (n) this.Node_result && this.Node_result.addChild(n), n.getComponent(cc.Animation).onAniEnd = function () {
                            n.removeFromParent(!0), n.destroy(), this.node.runAction(cc.sequence(cc.delayTime(1), t));
                        }.bind(this);
                    }
                }
            },
            showLuckyFlower: function (e) {
                var t = cc.instantiate(this.prefabLuckyFlower);
                this.Node_result && this.Node_result.addChild(t);
                var n = t.getComponent("NodeLuckyFlowerController");
                n && n.bindData(e);
            },
            showLoseEffect: function (e) {
                console.log("showLoseEffect ", this.nodeEffect);
                var t = e.seatId, n = cc.instantiate(this.effectNodePlayerStatus);
                n.getComponent("effectNodePlayerStatusController").bindData(7), this.nodeEffect && this.nodeEffect.addChild(n);
                var o = this._getEffectPos(t);
                n.setPosition(o), n.getComponent(cc.Animation).onAniEnd = function () {
                }.bind(this);
            },
            showZZCCEffect: function (e) {
                var t = e.seatId, n = cc.instantiate(this.effectNodePlayerStatus);
                Global.utils.searchComp(n, "tip", cc.Label).string = e.seatId, n.getComponent("effectNodePlayerStatusController").bindData(8),
                this.nodeEffect && this.nodeEffect.addChild(n);
                var o = this._getEffectPos(t);
                n.setPosition(o), this.chargingEffect[t] = n, n.getComponent(cc.Animation).onAniEnd = function () {
                }.bind(this);
            },
            removeNodeEffectChild: function (e) {
                this.chargingEffect && this.chargingEffect[e] && (this.chargingEffect[e].removeFromParent(!0),
                    this.chargingEffect[e].destroy());
            },
            onShowTingActions: function (e) {
                (this.nodeTingActions.active = !1, this._isShowingTingTip = !1, e && e.length > 0) && (this.nodeTingActions.active = !0,
                    this._isShowingTingTip = !0, this.nodeTingActions.getComponent("NodeTingActionsController").bindData(e));
            },
            updateTingActions: function (e) {
                this.nodeTingActions.getComponent("NodeTingActionsController").bindData(e);
            },
            onPlayEffectTing: function (e) {
                var t = cc.instantiate(this.effectNodeTingPrefab);
                this.nodeEffect && this.nodeEffect.addChild(t), t.setPosition(this._getEffectPos(e.seatId));
                t.getComponent(cc.Animation).onEffectChiEnd = function () {
                    t.removeAllChildren();
                }.bind(this);
            },
            onPlayEffectChi: function (e) {
                var t = cc.instantiate(this.effectNodeChiPrefab);
                this.nodeEffect && this.nodeEffect.addChild(t), t.setPosition(this._getEffectPos(e.seatId));
                t.getComponent(cc.Animation).onEffectChiEnd = function () {
                    t.removeAllChildren();
                }.bind(this);
            },
            onPlayEffectPeng: function (e) {
                var t = cc.instantiate(this.effectNodePengPrefab);
                this.nodeEffect && this.nodeEffect.addChild(t), t.setPosition(this._getEffectPos(e.seatId));
                t.getComponent(cc.Animation).onEffectPengEnd = function () {
                    t.removeAllChildren();
                }.bind(this);
            },
            onPlayEffectGang: function (e) {
                this.showGangEffect(e);
                var t = cc.instantiate(this.effectNodeGangPrefab);
                this.nodeEffect && this.nodeEffect.addChild(t), t.setPosition(this._getEffectPos(e.seatId));
                t.getComponent(cc.Animation).onEffectGangEnd = function () {
                    t.removeAllChildren();
                }.bind(this);
            },
            showGangEffect: function (e) {
                var t = null;
                if (e.gang && 1 == e.gang.style ? (t = cc.instantiate(this.effectNodeWind), o.playEffect("wind")) : e.gang && 0 == e.gang.style && (t = cc.instantiate(this.effectNodeRain),
                    o.playEffect("rain")), t) {
                    this.nodeEffect && this.nodeEffect.addChild(t), t.setPosition(this._getEffectPos(e.seatId));
                    t.getComponent(cc.Animation).onAniEnd = function () {
                        t.removeAllChildren();
                    }.bind(this);
                }
            },
            onPlayEffectHu: function (e) {
                if (!e.reconnect) {
                    var t = null;
                    t = e.winMode == Global.config.winMode.GangKai || e.winMode == Global.config.winMode.ZiMo ? cc.instantiate(this.effectNodeZiMoPrefab) : cc.instantiate(this.effectNodeHuPrefab),
                    this.nodeEffect && this.nodeEffect.addChild(t), t.setPosition(this._getEffectPos(e.seatId));
                    var n = this;
                    t.getComponent(cc.Animation).onEffectHuEnd = function () {
                        if (t.removeAllChildren(), Global.roomInfoModel.getPlayModel() == Global.config.playModel.XUEZHAN && Global.tableModel.getTableType() == Global.config.tableType.NORMAL) {
                            var o = Global.tableModel.toLocalSeatIndex(e.seatId), i = e.isGameEnd;
                            console.log("onPlayEffectHu", o, i), o != Global.config.SEAT_DOWN || i || setTimeout(function () {
                                n.node_btnChangeTable && n.nodeChangeTip && (n.node_btnChangeTable.active = !0,
                                    n.nodeChangeTip.active = !0);
                            }, 1500);
                        }
                    }.bind(this);
                }
            },
            onBtnChangeTable: function () {
                o.playEffect("select");
                var e = Global.tableModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                0 == e && 0 != t || Global.msgHandler.requestTableLeave(e, t, n);
                var i = Global.config.playModel.XUEZHAN;
                e = Global.roomInfoModel.getRecommendRoomId();
                Global.msgHandler.requestQuickStart(i, e);
            },
            _getEffectPos: function (e) {
                var t = cc.p(0, 0), n = Global.tableModel.toLocalSeatIndex(e);
                return n == Global.config.SEAT_DOWN && (t.x = this.effectPosDownX, t.y = this.effectPosDownY),
                n == Global.config.SEAT_RIGHT && (t.x = this.effectPosRightX, t.y = this.effectPosRightY),
                n == Global.config.SEAT_UP && (t.x = this.effectPosUpX, t.y = this.effectPosUpY),
                n == Global.config.SEAT_LEFT && (t.x = this.effectPosLeftX, t.y = this.effectPosLeftY),
                    t;
            },
            onClearOperation: function () {
                this.clearOperation();
            },
            clearOperation: function () {
                this.Node_operation && this.Node_operation.removeAllChildren(), this.Node_multigang_operation && this.Node_multigang_operation.removeAllChildren();
            },
            onClickMenu: function () {
                var e = this;
                if (cc.log("menuClick1=========="), o.playEffect("select"), !this.isMenuAniming) {
                    Global.spriteAtlas.setSpriteFrame(this.menuNode.getComponent(cc.Sprite), "Texture/chat_emotion", "GR_funtion_packup"),
                        this.isMenuAniming = !0, this.menuItem = cc.instantiate(this.menuItemPre), this.menuItem.opacity = 0,
                    this.menuNode && this.menuNode.addChild(this.menuItem), this.menuItem.height = 720;
                    var t = cc.v2(0, 49), n = function () {
                        this.isMenuAniming = !1, this.menuItem.setPosition(t);
                    }.bind(this), i = cc.fadeTo(.2, 255), a = cc.moveTo(.2, t).easing(cc.easeBackOut(3));
                    this.menuItem.runAction(new cc.Sequence(new cc.Spawn(i, a), cc.callFunc(n)));
                    var r = Global.utils.searchNode(this.menuNode, "Mask");
                    r.active = !0;
                    var s = Global.utils.searchNode(this.menuItem, "maskPart"),
                        l = Global.utils.searchNode(this.menuItem, "layout"),
                        c = Global.configCdn.getAdCrossListConf() || Global.configCdn.getDefaultConfig("adCrossList"),
                        d = Global.utils.searchComp(this.menuItem, "adCrossScrollView", cc.ScrollView),
                        u = tywx.AdManager.allAdInfoList || [];
                    if (this.adCrossLayout = d.content, Global.configCdn.getUISwitch()) {
                        if (this.adCrossLayout && (this.adCrossLayout.active = !0), c && c.gameMenu) {
                            var h = c.gameMenu, f = h.isRandom, p = h.limitIndex || 3, g = u.length, b = [];
                            if (f) for (var m = {}, _ = 0; _ < g && _ < p; _++) {
                                for (var y = Global.utils.randomInt(0, g - 1); m[y];) y = Global.utils.randomInt(0, g - 1);
                                m[y] = 1, u && u.length > 0 && b.push(u[y]);
                            } else for (var S = 0; S < g && S < p; S++) if (u && u.length > 0 && u[S]) {
                                var I = u[S];
                                b.push(I);
                            }
                            for (var v = function (t) {
                                var n = b[t], o = e._createItem();
                                if (o) {
                                    var i = o.getComponent("adCrossItem");
                                    G = function () {
                                        cc.isValid(o) && (o.scale = Global.config.nodeAdCrossScale);
                                    }, i.scheduleOnce(G, .1), i.setItemData(n);
                                }
                            }, C = 0; C < b.length; C++) {
                                var G;
                                v(C);
                            }
                        }
                    } else this.adCrossLayout && (this.adCrossLayout.active = !1);
                    this._onClickEvent(r, "touchstart", this.onMenuMask, this), this._onClickEvent(s, "touchstart", this.onInterceptEvent, this);
                    for (var T = ["onMenuMask", "onClickBack", "onClickSetting"], w = 0; w < l.children.length; w++) {
                        var E = l.children[w].getComponent(cc.Button);
                        if (T[w] && E) {
                            var A = new cc.Component.EventHandler();
                            A.target = this.node, A.component = "TableController", A.handler = T[w];
                            var N = new cc.Component.EventHandler();
                            N.target = this.node, N.component = "TableController", N.handler = "onMenuMask",
                                E.clickEvents.push(A), E.clickEvents.push(N);
                        }
                    }
                }
            },
            _createItem: function () {
                if (this.adCrossLayout) {
                    var e = cc.instantiate(this.prefabAdCrossItem);
                    return this.adCrossLayout.addChild(e), e;
                }
            },
            onInterceptEvent: function (e) {
                e.stopPropagation();
            },
            _onClickEvent: function (e, t, n, o) {
                e.on(t, this.onInterceptEvent, this), e.on(t, n.bind(o), o);
            },
            onMenuMask: function () {
                if (cc.log("menuClick2=========="), !this.isMenuAniming) if (this.isMenuAniming = !0,
                    this.menuItem) {
                    Global.spriteAtlas.setSpriteFrame(this.menuNode.getComponent(cc.Sprite), "Texture/chat_emotion", "GR_funtion_menu"),
                        Global.utils.searchNode(this.menuNode, "Mask").active = !1;
                    var e = function () {
                        this.isMenuAniming = !1, this.menuItem.destroy(), this.menuItem = null;
                    }.bind(this), t = cc.fadeTo(.2, 0), n = cc.moveTo(.2, 0, 769).easing(cc.easeBackIn(3));
                    this.menuItem.runAction(new cc.Sequence(new cc.Spawn(t, n), cc.callFunc(e)));
                } else this.isMenuAniming = !1;
            },
            onClickBack: function () {
                o.playEffect("select"), this._askBackPanel && (Global.UIPopupManager.removePopup(this._askBackPanel),
                    this._askBackPanel = null);
                var e = this;
                if (Global.tableModel.getTableType() == Global.config.tableType.CREATE) {
                    var t = {
                        text: "您是否要发起解散房间投票！！",
                        confirmText: "确定",
                        confirmSp: Global.spriteAtlas.getOKSpf(),
                        cancelText: "取消",
                        cancelSp: Global.spriteAtlas.getCancelSpf(),
                        confirmCallback: function () {
                            Global.msgHandler.requestDissolutionCustomRoom(Global.tableModel.getRoomId(), Global.tableModel.getTableId(), Global.tableModel.getSeatId());
                        },
                        cancelCallback: function () {
                            e._askBackPanel && (Global.UIPopupManager.removePopup(e._askBackPanel), e._askBackPanel = null);
                        }
                    };
                    this._askBackPanel = Global.UIPopupManager.alert(t);
                } else {
                    var n = {
                        text: "现在退出会由笨笨的机器人托管的哦~",
                        confirmText: "确定",
                        confirmSp: Global.spriteAtlas.getOKSpf(),
                        cancelText: "取消",
                        cancelSp: Global.spriteAtlas.getCancelSpf(),
                        confirmCallback: function () {
                            e._askBackPanel && (Global.UIPopupManager.removePopup(e._askBackPanel), e._askBackPanel = null),
                                e.doBack();
                        },
                        cancelCallback: function () {
                            e._askBackPanel && (Global.UIPopupManager.removePopup(e._askBackPanel), e._askBackPanel = null);
                        }
                    };
                    this._askBackPanel = Global.UIPopupManager.alert(n);
                }
            },
            doBack: function () {
                o.playEffect("select");
                var e = Global.tableModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                0 == e && 0 != t || Global.msgHandler.requestTableLeave(e, t, n), SceneHelper.loadScene("selectScene");
            },
            onClickCancelTrustee: function () {
                o.playEffect("select");
                var e = Global.tableModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                0 != e && 0 != t ? Global.msgHandler.requestCancelTrustee(e, t, n) : cc.error("TableController onClickCancelTrustee", "roomId = " + e + " tableId = " + t + " seatId = " + n);
            },
            onClickBtnTest: function () {
                var e = {
                    gameId: 201,
                    roomId: 2012001001,
                    tableId: 20120010010100,
                    seatId: 0,
                    userId: 10002,
                    detailDescList: [["点炮（清一色）", "4倍", 0, "对家"], ["被自摸（清一色）", "8倍", 0, "对家"], ["点炮（清一色）", "4倍", 0, "对家"], ["自摸（平胡，门清，断幺九）", "8倍", 480, "三家"], ["被自摸（清一色）", "8倍", -160, "对家"], ["自摸（平胡，门清，断幺九）", "8倍", 480, "三家"], ["被自摸（平胡，门清）", "4倍", -80, "下家"], ["被刮风", "2倍", -40, "对家"]],
                    totalScore: 680,
                    maxFanDesc: ""
                };
                Global.tableModel.detailInfo(e);
                e = {
                    gameId: 201,
                    roomId: 2012001001,
                    tableId: 20120010010100,
                    gameFlow: !1,
                    timestamp: 1525677782,
                    create_final: 0,
                    infos: [{
                        userId: 6011,
                        seatId: 0,
                        totalFan: -20,
                        totalScore: 400,
                        daHuFan: 52,
                        patternInfo: ["罗汉"],
                        tilesInfo: {
                            tiles: [3, 4, 5, 15, 3, 4, 5, 15, 3, 4],
                            gang: [{
                                tile: 9,
                                playerSeatId: 0,
                                pattern: [9, 9, 9, 9],
                                style: 1,
                                actionID: 40,
                                styleScore: 1
                            }],
                            chi: [],
                            peng: [],
                            zhan: [],
                            tile: [15, 15, 15]
                        },
                        bankrupt: !1
                    }, {
                        userId: 8008,
                        seatId: 1,
                        totalFan: -21,
                        totalScore: -420,
                        daHuFan: 52,
                        patternInfo: ["罗汉"],
                        tilesInfo: {
                            tiles: [1, 1, 1, 3, 3, 4, 5, 5, 5, 6, 7, 12, 12],
                            gang: [],
                            chi: [],
                            peng: [],
                            zhan: [],
                            tile: [4, 4]
                        },
                        bankrupt: !1
                    }, {
                        userId: 10021,
                        seatId: 2,
                        totalFan: -19,
                        totalScore: -380,
                        daHuFan: 52,
                        patternInfo: ["罗汉"],
                        tilesInfo: {
                            tiles: [1, 2, 3, 22, 22, 23, 23, 25, 26, 27],
                            gang: [],
                            chi: [],
                            peng: [[29, 29, 29]],
                            zhan: [],
                            tile: [23]
                        },
                        bankrupt: !1
                    }, {
                        userId: 2810,
                        seatId: 3,
                        totalFan: 20,
                        totalScore: 400,
                        daHuFan: 52,
                        patternInfo: ["罗汉"],
                        tilesInfo: {
                            tiles: [12, 13, 14, 17, 17, 22, 23, 24, 25, 26],
                            gang: [{
                                tile: 11,
                                playerSeatId: 1,
                                pattern: [11, 11, 11, 11],
                                style: 1,
                                actionID: 18,
                                styleScore: 2
                            }],
                            chi: [],
                            peng: [],
                            zhan: [],
                            tile: [24, 27, 21, 27, 21, 21, 24, 27, 21]
                        },
                        bankrupt: !1
                    }]
                };
                Global.notificationCenter.emit(Global.eventName.GAME_SHOW_RESULT, e);
            },
            onClickSetting: function () {
                console.log("onClickSetting"), o.playEffect("select"), Global.UIPopupManager.addPopup("PopupPanel/Panel_Setting");
            },
            onClickChat: function () {
                console.log("onClickChat"), o.playEffect("select"), Global.UIPopupManager.addPopup("PopupPanel/Panel_Chat");
            },
            onClickBill: function () {
                console.log("onClickChat"), o.playEffect("select"), Global.UIPopupManager.addPopup("PopupPanel/Panel_Bill");
            },
            onClickRule: function () {
                console.log("onClickRule"), o.playEffect("select"), Global.UIPopupManager.addPopup("PopupPanel/Panel_Rule", function (e) {
                });
            },
            onClickTingTip: function () {
                console.log("onClickTingTip"), o.playEffect("select");
                var e = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN).getTingResult();
                console.log("onClickTingTip data:", e), this._isShowingTingTip ? Global.notificationCenter.emit(Global.eventName.GAME_SHOW_TING_ACTION, null) : Global.notificationCenter.emit(Global.eventName.GAME_SHOW_TING_ACTION, e),
                    this._isShowingTingTip = !this._isShowingTingTip;
            },
            setIsShowingTingTip: function (e) {
                this._isShowingTingTip = e;
            },
            onTableClick: function () {
                console.log("onTableClick");
                var e = Global.tableModel.getIsGameEnd(), t = Global.tableModel.getIsTileUp();
                e || Global.tableModel.isInHuanPai || !t || (Global.notificationCenter.emit(Global.eventName.GAME_HUANPAI_UNSELECT_ALL),
                    Global.notificationCenter.emit(Global.eventName.GAME_RESET_TILE_YELLOW), Global.tableModel.setIsTileUp(!1));
            },
            onTCPClick: function () {
                console.log("onTCPClick"), Global.netWork.close();
            },
            onReconnectNetWork: function () {
                console.log("onReconnectNetWork :", Global.roomInfoModel, this.tableModel), Global.roomInfoModel && this.tableModel && this.reconnectToRoom();
            },
            onEnterBackground: function () {
                this._preTime = Date.parse(new Date());
                var e = Global.tableModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                0 == e && 0 != t || Global.msgHandler.requestHide(e, t, n);
            },
            reconnectToRoom: function () {
                if (Global.tableModel.getIsGameEnd()) {
                    var e = Date.parse(new Date()), t = new Date(e - this._preTime).getSeconds();
                    if (console.log("reconnectToRoom", e, this._preTime, t), t > 30) {
                        var n = Global.tableModel.getRoomId(), o = Global.tableModel.getTableId(),
                            i = Global.tableModel.getSeatId();
                        0 == n && 0 != o || Global.msgHandler.requestTableLeave(n, o, i);
                        var a = Global.tableModel.getTableType() == Global.config.tableType.CREATE ? "homeScene" : "selectScene";
                        SceneHelper.loadScene(a);
                    }
                    if (Global.tableModel.getTableType() == Global.config.tableType.CREATE) return Global.tableModel.getIsShowTotalResult() ? void 0 : void Global.msgHandler.requestNextRound(Global.tableModel.getRoomId(), Global.tableModel.getTableId(), Global.tableModel.getSeatId());
                } else {
                    var r = Global.roomInfoModel.getPlayModel();
                    n = Global.roomInfoModel.getRoomId(), o = this.tableModel.getTableId() || 0;
                    console.log("reconnectToRoom reconnect:", r, n, o), Global.msgHandler.requestQuickStart(r, n, o);
                }
            },
            onChargeResult: function (e) {
                if (e && (console.warn("充值结果回调++++++++++++++++", e.result), this.removeNodeEffectChild(e.seatId),
                e.result < 0)) {
                    var t = Global.tableModel.toLocalSeatIndex(e.seatId), n = Global.tableModel.getPlayerModel(t);
                    if (t == Global.config.SEAT_DOWN && (Global.UIPopupManager.removePopupByUrl("PopupPanel/Panel_recharge"),
                        Global.UIPopupManager.removePopupByUrl("PopupPanel/Panel_Reward_RotateLuck")), n && n.setState(Global.config.playState.CONFIRM_LOOSE),
                    Global.tableModel.isInGameScene() && !Global.tableModel.getIsGameEnd()) {
                        e = {
                            seatId: e.seatId
                        };
                        Global.notificationCenter.emit(Global.eventName.MSG_SHOW_CONFIRM_LOOSE, e);
                    }
                }
            },
            setMyDownTilesWidth: function (e, t, n) {
                this._myDownTilesWidth = e;
            },
            onClickContinue: function () {
                o.playEffect("select");
                if (Global.tableModel.getTableType() == Global.config.tableType.CREATE) if (Global.tableModel.getIsShowTotalResult()) {
                    var e = Global.tableModel.getTotalResult();
                    this.onShowTotalResult(e), this.node.active = !1;
                } else {
                    SceneHelper.loadScene("waittingScene", function () {
                        Global.utils.hideWaitting(), Global.msgHandler.requestNextRound(Global.tableModel.getRoomId(), Global.tableModel.getTableId(), Global.tableModel.getSeatId());
                    });
                } else this.quickStart();
            },
            quickStart: function () {
                Global.tableModel.setAllowPopupRotateLuckInGameEnd(!0);
                var e = {
                    playMode: Global.roomInfoModel.getPlayModel() || Global.config.playModel.XUELIU,
                    gameId: Global.config.GAMEID || Global.config.GAMEID_NORMAL,
                    type: "tableController quickStart"
                };
                Global.notificationCenter.emit(Global.eventName.MSG_DO_QUICK_START, e);
            }
        })
    }